package xyz.kongbai121.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.kongbai121.demo.domain.RespBean;
import xyz.kongbai121.demo.service.IUserService;
import xyz.kongbai121.demo.util.UserPowerException;

/**
 * 用户操作处理控制器
 *
 * @author 空白
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService service;

    @RequestMapping("/info")
    public RespBean info(String token) {
        return new RespBean(true, service.info(token));
    }

    @RequestMapping("/articlesListByUser")
    public RespBean articlesListByUser(String token) {
        return new RespBean(true, service.articlesListByUser(token));
    }

    @RequestMapping("/treeListByUser")
    public RespBean treeListByUser(String token) {
        return new RespBean(true, service.treeListByUser(token));
    }

    @RequestMapping("/articlesNum")
    public RespBean articlesNum(String token) {
        return new RespBean(true, service.getArticleNum(token));
    }

    @RequestMapping("/treeHoleNum")
    public RespBean treeHoleNum(String token) {
        return new RespBean(true, service.getTreeHoleNum(token));
    }

    @RequestMapping("/newCommentNum")
    public RespBean newCommentNum(String token) {
        return new RespBean(true, service.getNewCommentNum(token));
    }

    @RequestMapping("/commentLiseByUser")
    public RespBean commentLiseByUser(String token) {
        return new RespBean(true, service.getCommentList(token));
    }

    @RequestMapping("/newOpinionNum")
    public RespBean newOpinionNum(String token) {
        return new RespBean(true, service.getNewOpinionNum(token));
    }

    @RequestMapping("/opinionLiseByUser")
    public RespBean opinionLiseByUser(String token) {
        return new RespBean(true, service.getOpinionList(token));
    }

    @RequestMapping("/getUserId")
    public RespBean getUserId(String token) {
        return new RespBean(true, service.getUserId(token));
    }
}
